<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var fun1=function(){
				var reg=/^[A-z]\w{2,14}$/;
				var v=document.getElementById("t1").value;
				if(reg.test(v)){
				  document.getElementById("s1").innerHTML="OK";
				}
				else{
					document.getElementById("s1").innerHTML="ERROR";
				}
			}
			
			var fun2=function(){
				var reg=/^1\d{10}$/;
				var v=document.getElementById("t2").value;
				if(reg.test(v)){
				  document.getElementById("s2").innerHTML="OK";
				}
				else{
					document.getElementById("s2").innerHTML="ERROR";
				}
			}
			
			var fun3=function(){
				var reg=/^(0\d{3}-?\d{7})$|^(0\d{2}-?\d{8})$/;
				var v=document.getElementById("t3").value;
				if(reg.test(v)){
				  document.getElementById("s3").innerHTML="OK";
				}
				else{
					document.getElementById("s3").innerHTML="ERROR";
				}
			}
			
			var fun4=function(){
				var reg=/^(0|([1-9]\d{0,14}))(\.\d{1,2})?$/;
				var v=document.getElementById("t4").value;
				if(reg.test(v)){
				  document.getElementById("s4").innerHTML="OK";
				}
				else{
					document.getElementById("s4").innerHTML="ERROR";
				}
			}
		</script>
	</head>
	<body>
		输入用户昵称：<input type="text" id="t1">
		<button type="button" onclick="fun1()">检测</button>
		<span id="s1"></span><br>
		输入手机号码：<input type="text" id="t2">
		<button type="button" onclick="fun2()">检测</button>
		<span id="s2"></span><br>
		输入座机号码：<input type="text" id="t3">
		<button type="button" onclick="fun3()">检测</button>
		<span id="s3"></span><br>
		输入存款金额：<input type="text" id="t4">
		<button type="button" onclick="fun4()">检测</button>
		<span id="s4"></span><br>
		
		
		
	</body>
</html>
